<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSysLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('sys_logs'))
        {
            Schema::create('sys_logs', function (Blueprint $table) {
                $table->bigIncrements('id');
                $table->string('user_id', 45)->nullable()->comment('用户');
                $table->string('path', 100)->nullable()->comment('路径');
                $table->string('action', 45)->nullable()->comment('动作：C创建、U更新、D删除、O其他、S系统');
                $table->string('desc', 100)->nullable()->comment('描述');
                $table->string('ip', 45)->nullable()->comment('IP');
                $table->string('client', 200)->nullable()->comment('客户端');
                $table->tinyInteger('status')->default(1)->nullable()->comment('状态: 1 成功 0 失败');
                $table->text('remark')->nullable()->comment('备注');
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sys_logs');
    }
}
